package com.sz.wu.controller;

import com.sz.wu.client.UserClient;
import com.sz.wu.model.PageBean;
import com.sz.wu.model.Product;
import com.sz.wu.model.User;
import com.sz.wu.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/product")
public class ProductController {
    @Autowired
    private UserClient userClient;
    @Autowired
    private ProductService productService;

    //显示所有的商品
    @RequestMapping("/showAll")
    @ResponseBody
    public List<Product> showAll() {
        return productService.showAll();
    }


    //调用user
    @ResponseBody
    @RequestMapping("/user/showAll2")
    public List<User> showAll2() {
        System.out.println("来了吗");
        return userClient.showAll2();
    }
}
